package leecode

func maxStrength(nums []int) int64 {
	maxNum := nums[0]
	minNum := nums[0]
	for i := 1; i < len(nums); i++ {
		temp := maxNum
		maxNum = max(maxNum*nums[i], minNum*nums[i], maxNum, nums[i])
		minNum = min(minNum*nums[i], temp*nums[i], nums[i], minNum)
	}
	return int64(maxNum)
}
